@subject_radius: 90px;
@circle_num: 30;
@angle: 360deg / @circle_num;
@animation-duration: 1.5s;

.subject {
  position: relative;
  width: @subject_radius * 2;
  height: @subject_radius * 2;

  padding: 30px;

  .section {
    @circle_radius: 5px;
    position: absolute;
    left: 50%;
    top: 50%;
    margin-top: -@circle_radius;
    margin-left: -@circle_radius;
    width: @circle_radius * 2;
    height: @circle_radius * 2;

    perspective: 150px;
    transform-style: preserve-3d;

    &::before,
    &::after {
      content: '';
      position: absolute;
      width: 100%;
      height: 100%;
      border-radius: 50%;
    }

    &::after {
      background-color: gray;
      top: 100%;
      animation: moveWhite @animation-duration infinite;
    }

    &::before {
      background-color: black;
      top: -100%;
      animation: moveBlack @animation-duration infinite;
    }
    @keyframes moveBlack {
      0% {
        animation-timing-function: ease-in;
      }
    
      25% {
        transform: translate3d(0, 100%, @circle_radius);
        animation-timing-function: ease-out;
      }
    
      50% {
        transform: translate3d(0, 200%, 0);
      }
    
      75% {
        transform: translate3d(0, 100%, -@circle_radius);
        animation-timing-function: ease-out;
      }
    }
    
    @keyframes moveWhite {
      0% {
        animation-timing-function: ease-in;
      }
    
      25% {
        transform: translate3d(0, -100%, -@circle_radius);
        animation-timing-function: ease-out;
      }
    
      50% {
        transform: translate3d(0, -200%, 0);
      }
    
      75% {
        transform: translate3d(0, -100%, @circle_radius);
        animation-timing-function: ease-out;
      }
    }
  }

  each(range(@circle_num), {
    .section:nth-child(@{value}) {
      transform: rotate((@angle * @value)) translateY(-@subject_radius);
  
      &::after,
      &::before {
        animation-delay: (-@animation-duration / @circle_num * 3 * @value);
      }
    }
  });
}
